package cn.zhy.fegin;

import cn.zhy.domain.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @BelongsProject: springcloudnetflix-parent
 * @BelongsPackage: cn.itsource.feignclient
 * @Author: Director
 * @CreateTime: 2022-07-28  10:27
 * @Description: 调用User服务的feign客户端
 * @Version: 1.0
 */
@FeignClient(value = "user-server",fallback = UserFeignClientFallback.class) // 指定需要调用的服务的应用名称
public interface UserFeignClient {

    //调用方法和被调用方一致
    //服务的应用名称和被调用方一致
    //参数和返回值必须和被调用方一致
    @GetMapping("/getById/{id}")
    User getById(@PathVariable("id") Long id);

}